/*
 * @Author: samfeng
 * @Date: 2021-04-18 11:33:02
 * @LastEditTime: 2021-05-01 23:14:08
 * @LastEditors: Please set LastEditors
 * @Description: 点餐界面左边展示
 * @FilePath: /first_flutter_app/lib/views/orderPage/orderLeftPage.dart
 */

// import 'package:first_flutter_app/constant/dataInfo.dart';
import 'package:first_flutter_app/controller/orderPageController.dart';
import 'package:first_flutter_app/util/IconText.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

class OrderLeftPage extends StatelessWidget {
  var tableIndex = "";

  OrderLeftPage({Key key, this.tableIndex}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      width: 500.w,
      // height: ScreenUtil().setHeight(300),
      decoration: BoxDecoration(
        border: Border.all(color: Colors.black12, width: 0.5),
      ),
      child: Column(
        mainAxisAlignment: MainAxisAlignment.start,
        children: [orderTopTitel(tableIndex: this.tableIndex), doubleButton()],
      ),
    );
  }
}

// 头部展示
class orderTopTitel extends StatelessWidget {
  var tableIndex = "";
  orderTopTitel({Key key, this.tableIndex}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      child: GetBuilder<OrderController>(
        builder: (_) => Column(
          children: [
            titleShow(),
            secondeDetails(),
            OrderController.oc.iconActionIndex == 1
                ? orderProductsPage(tableIndex: this.tableIndex)
                : mainDetailsShow(),
          ],
        ),
      ),
    );
  }
}

// 第一部分
class titleShow extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      // height: 300.h,
      child: Column(
        children: [
          Container(
            color: Colors.blueAccent[400],
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                _backBtn(), // 返回
                _tableTxtShow(), // 桌台文字
                _cardShow(), // 卡片显示
                _moreShow(context), // 更多
              ],
            ),
          ),
        ],
      ),
    )
;
  }


  Widget _backBtn() {
    return Container(
      // margin: EdgeInsets.only(left: ScreenUtil().setSp(10)),
      height: ScreenUtil().setHeight(150),
      width: ScreenUtil().setWidth(150),
      decoration: BoxDecoration(
        shape: BoxShape.circle,
        border: Border.all(color: Colors.white, width: 1.5),
      ),
      child: InkWell(
        onTap: () {
          OrderController.oc.setShowOrderDetails(clickType: 'back');
          Get.back();
        },
        child: Center(
          child: Text(
            "<",
            style: TextStyle(
              color: Colors.white,
              fontSize: ScreenUtil().setSp(100),
            ),
          ),
        ),
      ),
    );
  }

  Widget _tableTxtShow() {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        Text(
          OrderController.oc.tableList[OrderController.oc.currentSelectTableIndex]['tableName'],
          style:
              TextStyle(fontSize: ScreenUtil().setSp(60), color: Colors.white),
        ),
        Text(
          "普通桌台",
          style:
              TextStyle(fontSize: ScreenUtil().setSp(30), color: Colors.white),
        ),
      ],
    );
  }

  Widget _cardShow() {
    return Container(
      width: ScreenUtil().setWidth(80),
      height: ScreenUtil().setHeight(200),
      margin: EdgeInsets.only(
        top: ScreenUtil().setSp(20),
        bottom: ScreenUtil().setSp(20),
      ),
      decoration: BoxDecoration(
          color: Colors.white,
          borderRadius: BorderRadius.only(
              topLeft: Radius.circular(4.0),
              topRight: Radius.circular(4.0),
              bottomLeft: Radius.circular(4.0),
              bottomRight: Radius.circular(4.0))),
      child: Column(
        children: [
          Container(
            margin: EdgeInsets.only(
              top: ScreenUtil().setSp(20),
              bottom: ScreenUtil().setSp(20),
            ),
            // height: ScreenUtil().setHeight(70),
            child: Text(
              "?",
              style: TextStyle(
                  color: Colors.orange, fontSize: ScreenUtil().setSp(60)),
            ),
          ),
          Expanded(
            child: Container(
              width: ScreenUtil().setWidth(98),
              alignment: Alignment.center,
              child: Text(
                "0min",
                textAlign: TextAlign.center,
                style: TextStyle(
                  color: Colors.white,
                ),
              ),
              decoration: BoxDecoration(
                  color: Colors.orange,
                  borderRadius: BorderRadius.only(
                      bottomLeft: Radius.circular(4.0),
                      bottomRight: Radius.circular(4.0))),
            ),
          ),
        ],
      ),
    );
  }

  Widget showMoreFun(BuildContext context) {
    return Stack(
      children: [
        Positioned(
            top: 330.h,
            // left: 100.w,
            width: 500.w,
            height: 800.h,
            child: new Material(
                child: Container(
                  color: Colors.white,
                  child: Wrap(
                      spacing: 8,
                      runSpacing: 5,
                      children: [
                        InkWell(
                          onTap: () {
                            Navigator.of(context).pop(); // 先关闭
                            OrderController.oc.setDraggableTable();
                            showDialog(
                              barrierColor: Color(0x00000001),
                              context: context,
                              builder: (BuildContext context) {
                                return AlertDialog(
                                  title: Text(
                                    '转台(点击该弹窗外的其他空白处可以关闭这个弹窗)',
                                    style: TextStyle(
                                      color: Colors.black54,
                                      fontSize: 15.0,
                                    ),
                                  ),
                                  content: Text(
                                    OrderController.oc.canDraggableTable==true?
                                    '您选择了转台,可以长按拖动桌台到其他的桌台上面去,就可以完成转台动作':
                                    '您已经关闭了转台动作,重新再点击可以激活转台功能',
                                    style: TextStyle(
                                        color: Colors.redAccent
                                    ),
                                  ),
                                );
                              },
                            );
                          },
                          child: Container(
                            width: 150.w,
                            child: Center(
                              child: Column(
                                children: [
                                  Container(
                                    padding: EdgeInsets.all(20.sp),
                                    margin: EdgeInsets.all(50.sp),
                                    decoration: BoxDecoration(
                                        color: Color.fromRGBO(241, 241, 244, 1),
                                        borderRadius: BorderRadius.all(Radius.circular(15.0))
                                    ),
                                    child: Icon(
                                      Icons.change_circle_outlined,
                                      color: Colors.black26,
                                    ),
                                  ),
                                  Text(
                                    "转台",
                                    style: TextStyle(color: Colors.grey),
                                  )
                                ],
                              ),
                            ),
                          ),
                        ),
                        InkWell(
                          child: Container(
                            width: 150.w,
                            child: Center(
                              child: Column(
                                children: [
                                  Container(
                                    padding: EdgeInsets.all(20.sp),
                                    margin: EdgeInsets.all(50.sp),
                                    decoration: BoxDecoration(
                                        color: Color.fromRGBO(241, 241, 244, 1),
                                        borderRadius: BorderRadius.all(Radius.circular(15.0))
                                    ),
                                    child: Icon(
                                      Icons.add_link,
                                      color: Colors.black26,
                                    ),
                                  ),
                                  Text(
                                    "合单",
                                    style: TextStyle(color: Colors.grey),
                                  )
                                ],
                              ),
                            ),
                          ),
                        ),
                        InkWell(
                          child: Container(
                            width: 150.w,
                            child: Center(
                              child: Column(
                                children: [
                                  Container(
                                    padding: EdgeInsets.all(20.sp),
                                    margin: EdgeInsets.all(50.sp),
                                    decoration: BoxDecoration(
                                        color: Color.fromRGBO(241, 241, 244, 1),
                                        borderRadius: BorderRadius.all(Radius.circular(15.0))
                                    ),
                                    child: Icon(
                                      Icons.drive_file_move_outline,
                                      color: Colors.black26,
                                    ),
                                  ),
                                  Text(
                                    "移菜",
                                    style: TextStyle(color: Colors.grey),
                                  )
                                ],
                              ),
                            ),
                          ),
                        ),
                        InkWell(
                          child: Container(
                            width: 150.w,
                            child: Center(
                              child: Column(
                                children: [
                                  Container(
                                    padding: EdgeInsets.all(20.sp),
                                    margin: EdgeInsets.all(50.sp),
                                    decoration: BoxDecoration(
                                        color: Color.fromRGBO(241, 241, 244, 1),
                                        borderRadius: BorderRadius.all(Radius.circular(15.0))
                                    ),
                                    child: Icon(
                                      Icons.copy,
                                      color: Colors.black26,
                                    ),
                                  ),
                                  Text(
                                    "复制",
                                    style: TextStyle(color: Colors.grey),
                                  )
                                ],
                              ),
                            ),
                          ),
                        ),
                        InkWell(
                          child: Container(
                            width: 150.w,
                            child: Center(
                              child: Column(
                                children: [
                                  Container(
                                    padding: EdgeInsets.all(20.sp),
                                    margin: EdgeInsets.all(50.sp),
                                    decoration: BoxDecoration(
                                        color: Color.fromRGBO(241, 241, 244, 1),
                                        borderRadius: BorderRadius.all(Radius.circular(15.0))
                                    ),
                                    child: Icon(
                                      Icons.dinner_dining_outlined,
                                      color: Colors.black26,
                                    ),
                                  ),
                                  Text(
                                    "起菜",
                                    style: TextStyle(color: Colors.grey),
                                  )
                                ],
                              ),
                            ),
                          ),
                        ),
                        InkWell(
                          child: Container(
                            width: 150.w,
                            child: Center(
                              child: Column(
                                children: [
                                  Container(
                                    padding: EdgeInsets.all(20.sp),
                                    margin: EdgeInsets.all(50.sp),
                                    decoration: BoxDecoration(
                                        color: Color.fromRGBO(241, 241, 244, 1),
                                        borderRadius: BorderRadius.all(Radius.circular(15.0))
                                    ),
                                    child: Icon(
                                      Icons.timer_outlined,
                                      color: Colors.black26,
                                    ),
                                  ),
                                  Text(
                                    "催菜",
                                    style: TextStyle(color: Colors.grey),
                                  )
                                ],
                              ),
                            ),
                          ),
                        )
                      ]
                  ),
                )
            )
        )
      ],
    );
  }

  Widget _moreShow(BuildContext context) {
    return Container(
      margin: EdgeInsets.only(left: 100.sp),
      height: 130.h,
      width: 130.w,
      decoration: BoxDecoration(
        shape: BoxShape.circle,
        border: Border.all(color: Colors.white, width: 1.5),
      ),
      child: Center(
        child: InkWell(
          onTap: () {
            showGeneralDialog(
                context: context,
                barrierColor: Color(0x00000001),
                barrierDismissible: true,
                barrierLabel: '',
                transitionDuration: Duration(milliseconds: 200),
                transitionBuilder: (BuildContext context,
                    Animation<double> animation,
                    Animation<double> secondaryAnimation,
                    Widget child) {
                  return FadeTransition(opacity: animation, child: child);
                },
                pageBuilder: (BuildContext context,
                    Animation<double> animation,
                    Animation<double> secondaryAnimation) {
                  return Center(
                      child: showMoreFun(context)
                  );
                });
          },
          child: Text(
            "更多",
            style: TextStyle(
              color: Colors.white,
              fontSize: ScreenUtil().setSp(45),
            ),
          ),
        ),
      ),
    );
  }
}

// 第二部分展示
class secondeDetails extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    var iconActionShow = {
      1: Container(
        margin: EdgeInsets.only(right: ScreenUtil().setSp(100)),
        child: Center(
          child: InkWell(
            onTap: () {
              OrderController.oc.iconAction();
            },
            child: Icon(Icons.expand_less, color: Colors.white),
          ),
        ),
      ),
      2: Container(
        margin: EdgeInsets.only(right: ScreenUtil().setSp(100)),
        child: InkWell(
          onTap: () {
            OrderController.oc.iconAction();
          },
          child: Stack(
            alignment: Alignment.center,
            children: [
              Icon(Icons.expand_more, color: Colors.white),
              Positioned(
                // bottom: 10,
                top: ScreenUtil().setSp(10),
                child: Icon(
                  Icons.arrow_drop_up,
                  color: Colors.white,
                  size: ScreenUtil().setSp(80),
                ),
              ),
            ],
          ),
        ),
      ),
    };

    return Container(
      height: 125.h,
      color: Colors.blueAccent,
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        // mainAxisSize: MainAxisSize.max,
        //交叉轴的布局方式，对于column来说就是水平方向的布局方式
        // crossAxisAlignment: CrossAxisAlignment.center,
        //就是字child的垂直布局方向，向上还是向下
        // verticalDirection: VerticalDirection.down,
        children: [
          GetBuilder<OrderController>(
            // init: OrderController(),
            builder: (_) => Container(
              margin: EdgeInsets.only(
                left: ScreenUtil().setSp(70),
              ),
              child: Text(
                "人数:${OrderController.oc.pNum.toString()}/4",
                style: TextStyle(
                    color: Colors.white, fontSize: ScreenUtil().setSp(30)),
              ),
            ),
          ),
          Container(
            // margin: EdgeInsets.fromLTRB(
            //     ScreenUtil().setSp(30),
            //     ScreenUtil().setSp(30),
            //     ScreenUtil().setSp(30),
            //     ScreenUtil().setSp(30)),
            child: Text(
              "服务员:封云森",
              style: TextStyle(
                  color: Colors.white, fontSize: ScreenUtil().setSp(30)),
            ),
          ),
          Container(
            // margin: EdgeInsets.fromLTRB(
            //     ScreenUtil().setSp(30),
            //     ScreenUtil().setSp(30),
            //     ScreenUtil().setSp(30),
            //     ScreenUtil().setSp(30)),
            child: Text(
              "点单员:封云森",
              style: TextStyle(
                  color: Colors.white, fontSize: ScreenUtil().setSp(30)),
            ),
          ),
          GetBuilder<OrderController>(
            // init: OrderController(),
            builder: (_) => iconActionShow[OrderController.oc.iconActionIndex],
          ),
        ],
      ),
    );
  }
}

// 订单服务信息(点餐人,服务人员)
class mainDetailsShow extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      // padding: EdgeInsets.only(
      //   bottom: 60.h,
      // ),
      // margin: EdgeInsets.only(bottom: ScreenUtil().setSp(180)),
      decoration: BoxDecoration(
        border: Border.all(
          color: Colors.black12,
          width: 0.5,
        ),
        borderRadius: BorderRadius.only(
            bottomLeft: Radius.circular(4.0),
            bottomRight: Radius.circular(4.0)),
      ),
      child: Container(
        // margin: EdgeInsets.only(
        //   bottom: ScreenUtil().setSp(22),
        // ),
        child: Column(
          children: [
            _grayTitle("就餐人数"),
            Container(
              height: 1200.h,
              child: Column(
                children: [
                  _orderPersons(),
                  _grayTitle("其他信息"),
                  _lineShow("服务员:", "封云森"),
                  _lineShow("点单员:", "封云森"),
                  _servicePersonDetail(),
                  _lineShow("销售员:", "暂无"),
                ],
              ),
            )
            // Offstage(
            //   offstage: OrderController.oc.iconActionIndex == 1 ? true : false,
            //   child: SizedBox(
            //     height: 235.h,
            //   ),
            // ),
          ],
        ),
      ),
    );
  }

  //灰色标题
  Widget _grayTitle(String str) {
    return Container(
      margin: EdgeInsets.only(top: ScreenUtil().setSp(30)),
      padding: EdgeInsets.all(ScreenUtil().setSp(15)),
      width: ScreenUtil().setWidth(450),
      decoration: BoxDecoration(
          color: Color.fromRGBO(243, 245, 247, 0.5),
          borderRadius: BorderRadius.all(
            //圆角
            Radius.circular(5.0),
          )),
      child: Text(
        str,
        style: TextStyle(
            color: Color.fromRGBO(102, 102, 102, 1),
            fontSize: ScreenUtil().setSp(30),
            fontWeight: FontWeight.w600),
      ),
    );
  }

  // 就餐人数
  Widget _orderPersons() {
    return Container(
      margin: EdgeInsets.only(
        top: 10.sp,
        left: ScreenUtil().setSp(50),
        right: ScreenUtil().setSp(50),
      ),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          Text(
            "就餐人数:",
            style: TextStyle(fontSize: ScreenUtil().setSp(50)),
          ),
          Row(
            children: [
              GetBuilder<OrderController>(
                  builder: (_) => ElevatedButton(
                        onPressed: () {
                          OrderController.oc.desPNum();
                        },
                        style: ElevatedButton.styleFrom(
                          shape: CircleBorder(),
                        ),
                        child: Icon(Icons.remove),
                      )),
              Container(
                child: GetBuilder<OrderController>(
                  builder: (_) => Text("${OrderController.oc.pNum.toString()}",
                      style: TextStyle(
                          color: Colors.blue,
                          fontSize: ScreenUtil().setSp(80))),
                ),
              ),
              GetBuilder<OrderController>(
                builder: (_) => ElevatedButton(
                  style: ElevatedButton.styleFrom(
                    shape: CircleBorder(),
                  ),
                  onPressed: () {
                    OrderController.oc.pluPNum();
                  },
                  child: Icon(Icons.add),
                ),
              ),
            ],
          ),
        ],
      ),
    );
  }

  Widget _lineShow(String title, String person) {
    return Container(
      // margin: EdgeInsets.all(
      //   ScreenUtil().setSp(54),
      // ),
      margin: EdgeInsets.only(
        left: 50.sp,
        top: 50.sp,
      ),
      padding: EdgeInsets.only(
        bottom: ScreenUtil().setSp(50),
      ),
      decoration: BoxDecoration(
        border: Border(
          bottom: BorderSide(color: Color.fromRGBO(233, 236, 239, 1)),
        ),
      ),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          Row(
            children: [
              Container(
                width: ScreenUtil().setWidth(5),
                height: ScreenUtil().setHeight(40),
                color: Colors.blue,
              ),
              Container(
                margin: EdgeInsets.only(left: ScreenUtil().setSp(20)),
                child: Text(
                  title,
                  style: TextStyle(fontSize: ScreenUtil().setSp(50)),
                ),
              ),
            ],
          ),
          Row(
            children: [
              Container(
                margin: EdgeInsets.only(right: ScreenUtil().setSp(20)),
                child: Text(
                  person,
                  style: TextStyle(fontSize: ScreenUtil().setSp(50)),
                ),
              ),
              Container(
                child: InkWell(
                  onTap: () {},
                  child: Icon(Icons.arrow_forward_ios, color: Colors.black12),
                ),
              ),
            ],
          ),
        ],
      ),
    );
  }

  //点单服务员明细
  Widget _servicePersonDetail() {
    return Container(
      margin: EdgeInsets.only(
        // top: ScreenUtil().setSp(30),
        left: ScreenUtil().setSp(50),
        right: ScreenUtil().setSp(50),
      ),
      // padding: EdgeInsets.only(
      //   bottom: ScreenUtil().setSp(30),
      // ),
      decoration: BoxDecoration(
        border: Border(
          bottom: BorderSide(color: Color.fromRGBO(233, 236, 239, 1)),
        ),
      ),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          Text(
            "点单服务员明细",
            style: TextStyle(
                fontWeight: FontWeight.w600,
                color: Color.fromRGBO(102, 102, 102, 1)),
          ),
          ElevatedButton(
            onPressed: () {},
            style: ButtonStyle(
              backgroundColor: MaterialStateProperty.resolveWith((states) {
                //设置按下时的背景颜色
                if (states.contains(MaterialState.pressed)) {
                  return Colors.blue[200];
                }
                //默认不使用背景颜色
                return Colors.white;
              }),
              //设置按钮的大小
              minimumSize: MaterialStateProperty.all(Size(40, 25)),
              //设置边框
              side: MaterialStateProperty.all(
                  BorderSide(color: Colors.blue, width: 1)),
            ),
            child: Text(
              "修改",
              style: TextStyle(
                color: Colors.blue,
                fontSize: ScreenUtil().setSp(35),
              ),
            ),
          ),
        ],
      ),
    );
  }
}

//点餐菜品展示页面
class orderProductsPage extends StatelessWidget {
  var tableIndex = "";
  orderProductsPage({key, this.tableIndex}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      width: ScreenUtil().setWidth(490),
      // height: ScreenUtil().setHeight(1170),
      padding: EdgeInsets.only(
        bottom: 65.h,
      ),
      decoration: BoxDecoration(
        border: Border.all(
          color: Colors.black12,
          width: 0.5,
        ),
        borderRadius: BorderRadius.only(
            bottomLeft: Radius.circular(4.0),
            bottomRight: Radius.circular(4.0)),
      ),
      child: Column(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          _grayTitle(OrderController.oc.orderStatus),
          _productListShow(context, int.parse(tableIndex)),
          _bottomTotalCount(),
        ],
      ),
    );
  }

  // 菜品信息状态标题
  Widget _grayTitle(String str) {
    return Container(
      margin: EdgeInsets.only(top: ScreenUtil().setSp(30)),
      padding: EdgeInsets.all(ScreenUtil().setSp(15)),
      width: ScreenUtil().setWidth(450),
      decoration: BoxDecoration(
          color: Color.fromRGBO(243, 245, 247, 0.5),
          borderRadius: BorderRadius.all(
            //圆角
            Radius.circular(5.0),
          )),
      child: IconText(
        OrderController.oc.orderStatus,
        icon: Icon(
          OrderController.oc.grayTitlediff
              ? Icons.check
              : Icons.remove_circle_sharp,
          color:
              OrderController.oc.grayTitlediff ? Colors.blue : Colors.black26,
        ),
        iconSize: 18.0,
        direction: Axis.horizontal,
        style: TextStyle(
            color: Colors.black26,
            fontSize: ScreenUtil().setSp(30),
            fontWeight: FontWeight.w600),
      ),
    );
  }


  // 菜品展示page
  Widget _productListShow(BuildContext context, int tableIndex) {
    return Container(
      height: 1020.h,
      child: MediaQuery.removePadding(
        context: context,
        removeTop: true,
        child: ListView.builder(
          shrinkWrap: true,
          itemBuilder: (context, index) {
            return InkWell(
                onLongPress: () {
                  OrderController.oc.setSelectShow();
                },
                onTap: () {
                  OrderController.oc.setProductListChangeColorsIndex(index);
                },
                onDoubleTap: () {
                  OrderController.oc.cleanProductListChangeColorsIndex();
                },
                child: Container(
                  decoration: BoxDecoration(
                    border: Border(
                      bottom: BorderSide(
                        width: 1.5,
                        color: Color.fromRGBO(233, 236, 239, 1),
                      ),
                      top: BorderSide(
                        width: 1.5,
                        color: Color.fromRGBO(233, 236, 239, 1),
                      ),
                    ),
                    color:
                        OrderController.oc.currentSelectOrderDetailsIndex == index
                            ? Colors.black12
                            : null,
                  ),
                  // margin: EdgeInsets.all(10),
                  padding: EdgeInsets.only(
                    left: ScreenUtil().setSp(20),
                    top: ScreenUtil().setSp(15),
                    right: ScreenUtil().setSp(20),
                    bottom: ScreenUtil().setSp(15),
                  ),
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Container(
                        child: Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: [
                            Offstage(
                              offstage: OrderController.oc.selectShow,
                              child: InkWell(
                                focusColor: Colors.black54,
                                onTap: () {
                                  OrderController.oc
                                      .updateSelectProductList(index);
                                },
                                child: Container(
                                  alignment: Alignment.center,
                                  width: ScreenUtil().setWidth(50),
                                  height: ScreenUtil().setHeight(50),
                                  decoration: BoxDecoration(
                                    shape: BoxShape.circle,
                                    color: OrderController.oc
                                        .tableList[OrderController.oc.currentSelectTableIndex]['orderDetail'].length>0?
                                    OrderController.oc.currentSelectTableIndex == index
                                        ? Colors.blue
                                        : Colors.black26:Colors.black26,
                                  ),
                                  child: Container(
                                    decoration: BoxDecoration(
                                        shape: BoxShape.circle,
                                        color: Colors.white),
                                    child: Icon(
                                      Icons.panorama_fish_eye_rounded,
                                      size: ScreenUtil().setSp(20),
                                      color: Colors.white,
                                    ),
                                  ),
                                ),
                              ),
                            ),
                            Container(
                              alignment: Alignment.center,
                              width: 140.w,
                              margin:
                                  EdgeInsets.only(left: ScreenUtil().setSp(10)),
                              child: Text(
                                OrderController.oc.tableList[OrderController.oc.currentSelectTableIndex]['orderDetail'][index]
                                ['productName'],
                                maxLines: 1,
                                overflow: TextOverflow.ellipsis,
                                style: TextStyle(
                                  fontSize: ScreenUtil().setSp(60),
                                  fontWeight: FontWeight.w800,
                                  color: Colors.black45,
                                ),
                              ),
                            ),
                          ],
                        ),
                      ),
                      Container(
                        child: Text(
                          'x ${OrderController.oc.tableList[OrderController.oc.currentSelectTableIndex]['orderDetail'][index]['qty']}',
                          style: TextStyle(
                            fontSize: ScreenUtil().setSp(50),
                            color: Colors.black45,
                          ),
                        ),
                      ),
                      Container(
                        // margin: EdgeInsets.only(right: ScreenUtil().setSp(40)),
                        child: Text(
                          OrderController.oc.tableList[OrderController.oc.currentSelectTableIndex]['orderDetail'][index]
                                  ['currency'] +
                              OrderController.oc.tableList[OrderController.oc.currentSelectTableIndex]['orderDetail'][index]['price']
                                  .toString(),
                          style: TextStyle(
                            fontSize: ScreenUtil().setSp(50),
                            color: Colors.black45,
                          ),
                        ),
                      ),
                    ],
                  ),
                ),
              );
          },
          // itemCount: OrderController.oc.currentSelectTable['orderDetail'].length,
          itemCount: OrderController.oc.tableList[tableIndex]['orderDetail'].length,
        ),
      )
    );
  }

  Widget _bottomTotalCount() {
    return Container(
      margin: EdgeInsets.only(top: ScreenUtil().setSp(20)),
      child: Row(
        children: [
          Container(
            child: Text(
              "合计:",
              style: TextStyle(
                fontSize: ScreenUtil().setSp(50),
                fontWeight: FontWeight.w800,
                color: Colors.black45,
              ),
            ),
          ),
          Container(
            child: Text(
              OrderController.oc.tableList[OrderController.oc.currentSelectTableIndex]['orderDetail'].length.toString(),
              style: TextStyle(
                fontSize: ScreenUtil().setSp(55),
                color: Colors.blue,
              ),
            ),
          ),
        ],
      ),
    );
  }
}

// 底部按钮
class doubleButton extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.only(top: 30.h),
      margin: EdgeInsets.only(
        left: 30.sp,
        right: 30.sp,
        bottom: 30.sp,
      ),
      decoration: BoxDecoration(
        border: Border(
          top: BorderSide(
            color: Color.fromRGBO(233, 236, 239, 1),
          ),
        ),
      ),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          ElevatedButton(
            onPressed: () {},
            style: ButtonStyle(
              backgroundColor: MaterialStateProperty.resolveWith((states) {
                //设置按下时的背景颜色
                if (states.contains(MaterialState.pressed)) {
                  return Colors.green;
                }
                //默认不使用背景颜色
                return Colors.blue;
              }),
            ),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                Container(
                  // margin: EdgeInsets.only(
                  //     top: ScreenUtil().setSp(30),
                  //     bottom: ScreenUtil().setSp(30),
                  //     right: ScreenUtil().setSp(50)),
                  decoration: BoxDecoration(
                    borderRadius: BorderRadius.circular(150),
                    color: Color.fromRGBO(63, 109, 204, 1),
                  ),
                  child: Icon(
                    Icons.chevron_left,
                    color: Colors.white,
                    size: 100.sp,
                  ),
                ),
                Container(
                  width: 120.w,
                  alignment: Alignment.center,
                  child: Text(
                    "传送后厨",
                    style: TextStyle(
                      color: Colors.white,
                      fontSize: 60.sp,
                    ),
                  ),
                ),
              ],
            ),
          ),
          ElevatedButton(
            onPressed: () {
              Get.toNamed("/PaymentPage");
            },
            style: ButtonStyle(
              // minimumSize: MaterialStateProperty.all(Size(150, 0)),
              backgroundColor: MaterialStateProperty.resolveWith((states) {
                //设置按下时的背景颜色
                if (states.contains(MaterialState.pressed)) {
                  return Colors.blue[800];
                }
                //默认不使用背景颜色
                return Colors.blue[600];
              }),
            ),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                GetBuilder<OrderController>(
                  builder: (_) => Container(
                    width: 120.w,
                    alignment: Alignment.center,
                    child: Text(
                      "￥${OrderController.oc.amountTotal.toString()}",
                      style: TextStyle(
                        color: Colors.white,
                        fontSize: 75.sp,
                      ),
                    ),
                  ),
                ),
                Container(
                  // margin: EdgeInsets.only(
                  //   top: ScreenUtil().setSp(30),
                  //   bottom: ScreenUtil().setSp(30),
                  //   left: ScreenUtil().setSp(50),
                  // ),
                  decoration: BoxDecoration(
                    borderRadius: BorderRadius.circular(150),
                    color: Color.fromRGBO(63, 109, 204, 1),
                  ),
                  child: Icon(
                    Icons.chevron_right,
                    color: Colors.white,
                    size: 100.sp,
                  ),
                ),
              ],
            ),
          ),
        ],
      ),
    );
  }
}
